load("//pkg/util/interval/generic:gen.bzl", "gen_interval_btree")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "spanconfigstore",
    srcs = [
        "bounds_reader.go",
        "interner.go",
        "span_store.go",
        "store.go",
        "system_store.go",
        ":entry_interval_btree.go",  # keep
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/spanconfig/spanconfigstore",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/keys",
        "//pkg/multitenant/tenantcapabilities",
        "//pkg/roachpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/spanconfig",
        "//pkg/spanconfig/spanconfigbounds",
        "//pkg/util/iterutil",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",  # keep
        "@com_github_cockroachdb_errors//:errors",
    ],
)

go_test(
    name = "spanconfigstore_test",
    srcs = [
        "span_store_test.go",
        "store_test.go",
        "system_store_test.go",
        ":entry_interval_btree_test.go",  # keep
    ],
    data = glob(["testdata/**"]),
    embed = [":spanconfigstore"],
    deps = [
        "//pkg/keys",
        "//pkg/roachpb",
        "//pkg/settings/cluster",
        "//pkg/spanconfig",
        "//pkg/spanconfig/spanconfigbounds",
        "//pkg/spanconfig/spanconfigtestutils",
        "//pkg/testutils/datapathutils",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/randutil",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_stretchr_testify//require",
    ],
)

gen_interval_btree(
    name = "spanconfig_interval_btree",
    package = "spanconfigstore",
    type = "*entry",
)
